package svc

import (
	"api/internal/config"
	"api/internal/middleware"
	"github.com/zeromicro/go-zero/rest"
	"github.com/zeromicro/go-zero/zrpc"
	"hr_srv/hrsrvclient"
)

type ServiceContext struct {
	Config              config.Config
	HrSrv               hrsrvclient.HrSrv
	UserAgentMiddleware rest.Middleware
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:              c,
		HrSrv:               hrsrvclient.NewHrSrv(zrpc.MustNewClient(c.HrSrv)),
		UserAgentMiddleware: middleware.NewUserAgentMiddleware().Handle}
}
